Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
jsonml.org compatible tool set.
npm i onml --save
var onml = require('onml');
The onml.parse()
method parses a XML/HTML/SVG string and returns a JavaScript value.
var obj = onml.parse('<text a="5">so me</text>');
console.log(obj);
-->
["text", {a: "5"}, "so me"]
The onml.stringify(array, [indentation])
method converts a JavaScript value to a XML/HTML/SVG string.
var str = onml.stringify(['text', {a: 55}, 'so me'], 2);
console.log(str);
-->
<text a="55">
so me
</text>
JSONML object traversal tool. See test/traverse.js for more details.
onml.traverse(obj, {
enter: function (node, parent) {
...
},
leave: function (node, parent) {
...
}
});
Inside enter
and leave
functions:
node
and parent
objects have the following attributes:
.name
-- tag name.attr
-- attributes object.full
-- full node arraythis
will hold additional methods:
this.name(string)
-- to change the node tagthis.skip()
-- to skip subtree based on the current nodethis.remove()
-- to remove current nodethis.replace(array)
-- to replace current node// count divs on enter
var count = 0;
onml.traverse(
['b',
['div', {a: true},
['span',
'div',
['div',
['div', {},
['div', {a: true}]
]
],
['div', {},
['div']
]
]
]
],
{
enter: function (node) {
if (node.name === 'div') {
count++;
}
}
}
);
console.log(count);
-->
6
npm test
MIT LICENSE.
FAQs
JSONML Library
The npm package onml receives a total of 1,500 weekly downloads. As such, onml popularity was classified as popular.
We found that onml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.